package oo.day05.union;

public class ICBCImpl implements ICBC {
	private double balance;
	private String pwd;

	ICBCImpl(double balance, String pwd) {
		this.balance = balance;
		this.pwd = pwd;
	}

	public boolean saveMoney(int num) {
		balance += num;
		return true;
	}

	public boolean getMoney(double num) {
		if(balance >= num) {
			balance -= num;
			return true;
		}
		return false;
	}

	public double queryMoney() {
		return balance;
	}

	public boolean checkPwd(String pwd) {
		if (pwd.equals(this.pwd)) {
			return true;
		}
		return false;
	}

	public boolean payOnline(double num) {
		if (balance >= num) {
			balance -= num;
			return true;
		}
		return false;
	}
}
